import request from '@/utils/httpRequest'
// 创建保存分类信息
export function categoryCreate(query) {
  return request({
    url: '/bsnl-product/category/create',
    method: 'post',
    data: query
  })
}
// 更新分类信息
export function categoryUpdate(query) {
  return request({
    url: '/bsnl-product/category/update',
    method: 'post',
    data: query
  })
}
// 查询单个分类信息(根据id)
export function getCategoryById(id, query) {
  return request({
    url: '/bsnl-product/category/' + id,
    method: 'get',
    data: query
  })
}
// 获取分类树形结构信息
export const categoryTree = params => request({
    url: '/bsnl-product/category/tree',
    method: 'get',
    params
});

// 删除/恢复分类(根据id)
export function editCategoryDeleteFlagById(query) {
  return request({
    url: '/bsnl-product/category/delete',
    method: 'post',
    data: query
  })
}
// 编辑分类显示状态(根据id)
export function editCategoryStatusById(query) {
  return request({
    url: '/bsnl-product/category/status',
    method: 'post',
    data: query
  })
}
// 获取全部的分类信息
export function categoryList(query) {
  return request({
    url: '/bsnl-product/category/list',
    method: 'get',
    params: query
  })
}
// 通过父类Id获取子类
export function getSubCategoriesByParentId(id, query) {
  return request({
    url: '/bsnl-product/sub/category/' + id,
    method: 'get',
    params: query
  })
}
// 通过分类名查询分类
export function getCategoryByName(query) {
  return request({
    url: '/bsnl-product/category/name',
    method: 'get',
    params: query
  })
}
// 模糊查询分类信息
export function categoryQuery(query) {
  return request({
    url: '/bsnl-product/category/query',
    method: 'post',
    data: query
  })
}
